package com.woniuxy.service.impl;

import com.woniuxy.dao.InpatientInspectDao;
import com.woniuxy.entity.InpatientInspect;
import com.woniuxy.service.InpatientInspectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Service
public class InpatientInspectServiceImpl implements InpatientInspectService {
    @Autowired
    InpatientInspectDao inpatientInspectDao;

    @Override
    public void insertInpatientInspect(InpatientInspect inpatientInspect) {
        inpatientInspect.setInpatientInspectTime(new Date());
        inpatientInspect.setInpatientInspectPrice(inpatientInspect.getInpatientInspectPrice().multiply(new BigDecimal(inpatientInspect.getInpatientInspectNum())));
        inpatientInspectDao.insertInpatientInspect(inpatientInspect);
    }

    @Override
    public List<InpatientInspect> getInpatientInspect(int inpatientId) {
        List<InpatientInspect> inpatientInspects = inpatientInspectDao.selectInpatientInspect(inpatientId);
        return inpatientInspects;
    }

    @Override
    public void updateInpatientInspectResult(int inpatientInspectId, String inpatientInspectResult) {
        inpatientInspectDao.updateInpatientInspectResult(inpatientInspectId, inpatientInspectResult);
    }

    @Override
    public void addInpatientInspectImg(int inpatientInspectId, String inpatientInspectImg) {
        inpatientInspectDao.addInpatientInspectImg(inpatientInspectId, inpatientInspectImg);
    }
}
